|
|
 |
|
|
|
|
"Error #: " & _
oErr.Number & vbCrLf
strMsg = strMsg & _
"Description: " & _
oErr.Description & vbCrLf
strMsg = strMsg & _
"Source: " & _
oErr.Source & vbCrLf
strMsg = strMsg & _
"SQL State: " & _
oErr.SQLState & vbCrLf
strMsg = strMsg & _
"Native Error: " & _
oErr.NativeError & vbCrLf
strMsg = strMsg & vbCrLf
Next
MsgBox strMsg
End Sub |
|
|
|
|
|
|
|
|
The Error.frm file has an example of using the error handler. In the example are misspelled columns that, when submitted to the Open method of the Recordset object, generate an error. The current version of the Jet OLE DB provider does not give you very descriptive error messages right now. By the time you read this, however, this may have changed. To see a good example of some error messages, use either the SQL Server or Oracle provider: |
|
|
|
 |
|
|
|
|
Private Sub cmdTestErr_Click()
Dim oRS As Recordset
Dim strSQL As String
On Error GoTo Error_EH
' MISPELLED Column Names
strSQL = "SELECT "
strSQL = strSQL & "sLast_nm, "
strSQL = strSQL & "szFirst_nm "
strSQL = strSQL & "FROM tblEmployees " |
|
|
|
|
|